//
//  ZCInvolvedToolView.m
//  zctx
//
//  Created by apple on 16/4/13.
//  Copyright © 2016年 sanliang. All rights reserved.
//

#import "ZCInvolvedToolView.h"

@interface ZCInvolvedToolView ()

@end

@implementation ZCInvolvedToolView

-(void)awakeFromNib{
    self.backgroundColor = [UIColor colorWithHexString:@"#F4F5F7"];
    self.contentView.layer.borderWidth =0.6;
    self.contentView.layer.borderColor = [UIColor groupTableViewBackgroundColor].CGColor;
    self.contentView.layer.cornerRadius = 17;
    self.contentView.backgroundColor = [UIColor whiteColor];
    [self.textfiled setValue:[UIColor colorWithHexString:@"#8a8a8a"] forKeyPath:@"_placeholderLabel.textColor"];
    
    self.commentNumLable.backgroundColor = [UIColor colorWithHexString:@"#FD4744"];
    self.commentNumLable.layer.cornerRadius = 5;
    self.commentNumLable.layer.masksToBounds = YES;
    self.commentNumLable.hidden = YES;
    
    self.lineView.backgroundColor = RGB(236, 237, 238);
    
}

-(void)setInvolvedModel:(ZCInvolvedDetailsModelContent *)involvedModel{
    if (involvedModel.ifcollection ==0) {
        [self.collectBtn setImage:[UIImage imageNamed:@"involve_tool_xing_no"] forState:UIControlStateNormal];
    }else{
        [self.collectBtn setImage:[UIImage imageNamed:@"involve_tool_xing_yes"] forState:UIControlStateNormal];
    }
    NSString *commentCout = [NSString stringWithFormat:@"%@",involvedModel.commentCount];
    if ([commentCout isEqualToString:@"0"]) {
        self.commentNumLable.hidden = YES;
    }else{
        self.commentNumLable.hidden = NO;
        self.commentNumLable.text = commentCout;
        CGSize size = [commentCout sizeForMaxWidth:100 font:[UIFont systemFontOfSize:10]];
        self.NumConstaint.constant =size.width + 10;
    }
}

-(void)setModelDic:(NSDictionary *)ModelDic{
    
    NSInteger ifcollection  = [[NSString stringWithFormat:@"%@",[ModelDic objectForKey:@"ifcollection"]] integerValue];
    if (ifcollection  == 1) {
        [self.collectBtn setImage:[UIImage imageNamed:@"involve_tool_xing_yes"] forState:UIControlStateNormal];
    }else{
        [self.collectBtn setImage:[UIImage imageNamed:@"involve_tool_xing_no"] forState:UIControlStateNormal];
    }
    
    NSString *coment_count  = [NSString stringWithFormat:@"%@",[ModelDic objectForKey:@"comment_count"]];
    if ([coment_count isEqualToString:@"0"]) {
        self.commentNumLable.hidden = YES;
    }else{
        self.commentNumLable.hidden = NO;
        self.commentNumLable.text = coment_count;
        CGSize size = [coment_count sizeForMaxWidth:100 font:[UIFont systemFontOfSize:10]];
        self.NumConstaint.constant =size.width + 10;
    }
}

#pragma mark 分享
- (IBAction)ClickShareBtn:(UIButton *)sender {
    self.TshareBlock();
}
#pragma mark 收藏
- (IBAction)ClickCollectBtn:(UIButton *)sender {
    self.TcollectBlock();
}
#pragma mark 评论
- (IBAction)ClickCommentBtn:(UIButton *)sender {
    self.TcommentBlock();
}

- (IBAction)sendBtn:(UIButton *)sender {
    self.TtextfiledBlock();
}


@end
